import request from '@/utils/request'

// 查询巡检计划列表
export const listPlan = (params) => request.get('/ar_check/plan/list', { params })

// 查询待审核巡检计划
export const ApprovalListPlan = (params) =>
    request.get('/ar_check/plan/pending-approval', { params })


// 查询巡检计划详细
export function getPlan(planId) {
    return request({
        url: '/ar_check/plan/' + planId,
        method: 'get'
    })
}

// 新增巡检计划
export function addPlan(data) {
    return request({
        url: '/ar_check/plan',
        method: 'post',
        data: data
    })
}

// 修改巡检计划
export function updatePlan(data) {
    return request({
        url: '/ar_check/plan',
        method: 'put',
        data: data
    })
}

// 删除巡检计划
export function delPlan(planId) {
    return request({
        url: '/ar_check/plan/' + planId,
        method: 'delete'
    })
}

/** 发起申请*/
export const planApply = (data) => request.put('/ar_check/plan/apply', data)

/** 通过或驳回*/
export const approvePlan = (row) => request.put(`/ar_check/plan/${row.planId}/approve/${row.flag}`)
